package com.example.mylibrary.data;

import com.example.mylibrary.greendao.DaoSession;
import com.example.mylibrary.greendao.StudentInfoDao;
import com.example.mylibrary.greendao.StudentRollCallDao;

import org.greenrobot.greendao.DaoException;
import org.greenrobot.greendao.annotation.Entity;
import org.greenrobot.greendao.annotation.Generated;
import org.greenrobot.greendao.annotation.Id;
import org.greenrobot.greendao.annotation.NotNull;
import org.greenrobot.greendao.annotation.ToOne;
import org.greenrobot.greendao.annotation.Unique;


/**
 * Created by Administrator on 2017/12/11.
 * 入口验证记录表
 */
@Entity
public class StudentRollCall {
    //检录id
    @Id(autoincrement = true)
    private Long    rollCallID;

    //学生id
    @Unique
    private long    StudentID;
    @ToOne(joinProperty = "StudentID")
    private StudentInfo studentInfo;

    //检录时间
    private String  rollCalltime;
    //入场验证通过保存的人脸图像路径
    private String  facePath;

    //验证结果  0未通过/1通过   默认为0不通过
    @NotNull private int  rollCall_State;

    /** Used to resolve relations */
    @Generated(hash = 2040040024)
    private transient DaoSession daoSession;

    /** Used for active entity operations. */
    @Generated(hash = 1947755960)
    private transient StudentRollCallDao myDao;

    @Generated(hash = 603921897)
    public StudentRollCall(Long rollCallID, long StudentID, String rollCalltime,
            String facePath, int rollCall_State) {
        this.rollCallID = rollCallID;
        this.StudentID = StudentID;
        this.rollCalltime = rollCalltime;
        this.facePath = facePath;
        this.rollCall_State = rollCall_State;
    }

    @Generated(hash = 1979653016)
    public StudentRollCall() {
    }

    public Long getRollCallID() {
        return this.rollCallID;
    }

    public void setRollCallID(Long rollCallID) {
        this.rollCallID = rollCallID;
    }

    public long getStudentID() {
        return this.StudentID;
    }

    public void setStudentID(long StudentID) {
        this.StudentID = StudentID;
    }

    public String getRollCalltime() {
        return this.rollCalltime;
    }

    public void setRollCalltime(String rollCalltime) {
        this.rollCalltime = rollCalltime;
    }

    public String getFacePath() {
        return this.facePath;
    }

    public void setFacePath(String facePath) {
        this.facePath = facePath;
    }

    public int getRollCall_State() {
        return this.rollCall_State;
    }

    public void setRollCall_State(int rollCall_State) {
        this.rollCall_State = rollCall_State;
    }

    @Generated(hash = 2140021173)
    private transient Long studentInfo__resolvedKey;

    /** To-one relationship, resolved on first access. */
    @Generated(hash = 1477322235)
    public StudentInfo getStudentInfo() {
        long __key = this.StudentID;
        if (studentInfo__resolvedKey == null
                || !studentInfo__resolvedKey.equals(__key)) {
            final DaoSession daoSession = this.daoSession;
            if (daoSession == null) {
                throw new DaoException("Entity is detached from DAO context");
            }
            StudentInfoDao targetDao = daoSession.getStudentInfoDao();
            StudentInfo studentInfoNew = targetDao.load(__key);
            synchronized (this) {
                studentInfo = studentInfoNew;
                studentInfo__resolvedKey = __key;
            }
        }
        return studentInfo;
    }

    /** called by internal mechanisms, do not call yourself. */
    @Generated(hash = 671034099)
    public void setStudentInfo(@NotNull StudentInfo studentInfo) {
        if (studentInfo == null) {
            throw new DaoException(
                    "To-one property 'StudentID' has not-null constraint; cannot set to-one to null");
        }
        synchronized (this) {
            this.studentInfo = studentInfo;
            StudentID = studentInfo.getStudentID();
            studentInfo__resolvedKey = StudentID;
        }
    }

    /**
     * Convenient call for {@link org.greenrobot.greendao.AbstractDao#delete(Object)}.
     * Entity must attached to an entity context.
     */
    @Generated(hash = 128553479)
    public void delete() {
        if (myDao == null) {
            throw new DaoException("Entity is detached from DAO context");
        }
        myDao.delete(this);
    }

    /**
     * Convenient call for {@link org.greenrobot.greendao.AbstractDao#refresh(Object)}.
     * Entity must attached to an entity context.
     */
    @Generated(hash = 1942392019)
    public void refresh() {
        if (myDao == null) {
            throw new DaoException("Entity is detached from DAO context");
        }
        myDao.refresh(this);
    }

    /**
     * Convenient call for {@link org.greenrobot.greendao.AbstractDao#update(Object)}.
     * Entity must attached to an entity context.
     */
    @Generated(hash = 713229351)
    public void update() {
        if (myDao == null) {
            throw new DaoException("Entity is detached from DAO context");
        }
        myDao.update(this);
    }

    /** called by internal mechanisms, do not call yourself. */
    @Generated(hash = 424482850)
    public void __setDaoSession(DaoSession daoSession) {
        this.daoSession = daoSession;
        myDao = daoSession != null ? daoSession.getStudentRollCallDao() : null;
    }


}
